package com.luo.controller;

import com.luo.pojo.Driver;
import com.luo.service.DriverService;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/driver")
public class DriverController {

    @Resource
    private DriverService driverService;

    @RequestMapping(value = "/selectDriverList",method = RequestMethod.GET)
    public Map<String,Object> selectDriverList(
            @RequestParam int page,
            @RequestParam int limit,
            String username ,
            String phone,
            String driverCard,
            String driverType){
        return driverService.selectDriverList(username,phone, driverCard,driverType,page,limit);
    }

    @RequestMapping(value = "/delete",method = RequestMethod.POST)
    public Map<String,Object> delete(@RequestParam Integer id){
        return driverService.delete(id);
    }

    @RequestMapping(value = "/insert",method = RequestMethod.POST)
    public Map<String,Object> insert(@RequestBody Driver driver){
        return driverService.insert(driver);
    }

    @RequestMapping(value = "/update",method = RequestMethod.POST)
    public Map<String,Object> update(@RequestBody Driver driver){
        return driverService.update(driver);
    }

}
